<template>
  <view class="container">
    <!-- 顶部组件 -->
    <u-navbar
      id="nav-bar"
      is-back
      :background="{ background: 'transparent' }"
      :border-bottom="false"
      title=" "
    >
      <view class="segmentedBox">
        <u-subsection
          :list="subsectionList"
          :current="subsectionIndex"
          bgColor="rgba(255,255,255,0.4)"
          @change="subsectionChange"
        >
        </u-subsection>
      </view>
    </u-navbar>

    <image class="bg" src="/static/images/icon-zyhkbBg.png" mode="widthFix"></image>
    <view class="tipBox">
      <view class="tip">助力伙伴 轻松展业</view>
      <view class="tip1">为更多人提供创业联盟服务</view>
    </view>

    <view class="content">
      <view class="item">
        <view class="header">
          <image class="avatar" src="/static/images/logo.png" mode="widthFix"></image>
          <view class="info">
            <view class="name">张三三</view>
            <view class="phone">18888888888</view>
          </view>
          <view class="btnGroup">
            <view class="btn" @click="navigateTo('/pages/home/incomeDetails')">明细</view>
            <template v-if="subsectionIndex === 0">
              <view class="spe"></view>
              <view class="btn">结清</view>
            </template>
          </view>
          <image
            v-if="subsectionIndex === 1"
            class="statusImg"
            src="/static/images/icon-yjq.png"
            mode="widthFix"
          ></image>
        </view>
        <view class="dataShow">
          <view class="data">
            <view class="value">12012392.83</view>
            <view class="label">已还款金额</view>
          </view>
          <view class="data">
            <view class="value">1231.12</view>
            <view class="label">未还款金额</view>
          </view>
          <view class="data">
            <view class="value">4192837.17</view>
            <view class="label">总欠款金额</view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      subsectionList: [
        {
          name: '未结清',
        },
        {
          name: '已结清',
        },
      ],
      subsectionIndex: 0,
    };
  },
  onLoad: function (options) {
    this.getData(0);
  },
  methods: {
    subsectionChange(index) {
      this.subsectionIndex = index;
      this.getData(index);
    },
    getData(index) {},
    navigateTo(url) {
      uni.navigateTo({
        url: url,
      });
    },
  },
};
</script>
<style lang="scss" scope>
.container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 0 0 120rpx;
  background-color: #f5f5f5;
  box-sizing: border-box;
  .bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    z-index: 0;
  }

  .tipBox {
    position: fixed;
    top: 240rpx;
    left: 0;
    width: 100%;
    padding: 0 60rpx;
    text-align: left;
    z-index: 1;
    .tip {
      width: 100%;
      font-weight: 800;
      font-size: 42rpx;
      color: #b7926e;
      line-height: 1;
    }
    .tip1 {
      margin-top: 24rpx;
      width: 100%;
      font-weight: 400;
      font-size: 24rpx;
      color: #999999;
      line-height: 1;
    }
  }

  .segmentedBox {
    position: absolute;
    top: 10rpx;
    left: 50%;
    transform: translateX(-50%);
    width: 300rpx;
    z-index: 99;
  }
}

.content {
  position: relative;
  width: 100%;
  padding: 220rpx 30rpx 60rpx;
  z-index: 99;
  .item {
    float: left;
    position: relative;
    margin-bottom: 30rpx;
    width: 100%;
    padding: 30rpx;
    background: #ffffff;
    border-radius: 20rpx;
    .header {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      width: 100%;

      .avatar {
        width: 98rpx;
        height: 98rpx;
        border-radius: 50%;
      }
      .info {
        flex: 1;
        min-width: 0;
        padding-right: 20rpx;
        text-align: left;
        line-height: 1;
        .name {
          font-weight: 800;
          font-size: 28rpx;
          color: #333333;
        }
        .phone {
          margin-top: 20rpx;
          font-family: DIN;
          font-weight: bold;
          font-size: 32rpx;
          color: #333333;
        }
      }
      .btnGroup {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        .btn {
          position: relative;
          font-weight: 500;
          font-size: 24rpx;
          color: #b7926e;
          z-index: 100;
        }
        .spe {
          width: 2rpx;
          height: 23rpx;
          margin: 0 20rpx;
          background-color: #cccccc;
        }
      }
      .statusImg {
        position: absolute;
        top: 0;
        right: 30rpx;
        width: 146rpx;
        height: auto;
        z-index: 99;
      }
    }
    .dataShow {
      display: flex;
      justify-content: space-between;
      margin-top: 30rpx;
      width: 100%;
      padding: 30rpx;
      background: #f7f7f7;
      border-radius: 16rpx;
      .data {
        flex: 1;
        min-width: 0;
        text-align: center;
        .value {
          font-family: DIN, sans-serif;
          font-weight: bold;
          font-size: 32rpx;
          color: #333333;
        }
        .label {
          margin-top: 12rpx;
          font-weight: 400;
          font-size: 24rpx;
          color: #999999;
        }
      }
    }
  }
}
</style>
